// Fluxions 3D Engine
// fluxions/glut_template.hpp
// Copyright (C) 2000-2011 Jonathan Metzgar
// 
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#ifndef FLUXIONS_GLUT_TEMPLATE_HPP
#define FLUXIONS_GLUT_TEMPLATE_HPP

#include "opengl.hpp"
#include "fluxions/glut_extensions.hpp"
#include "viperfish/application.hpp"
#include "fluxions/html_colors.hpp"

class GlutTemplate
{
public:
	GlutTemplate();
	~GlutTemplate();
	
	void Init(int argc, char **argv);
	void SetVideoMode(int width, int height, int bpp, bool fullscreen);
	void RegisterViperfish();
	void RegisterApplication(Viperfish::Application *app);
	void Start();


	void OnInit();
	void OnKill();

	void OnUpdate(double deltaTime);
	void OnTimer(int timerId, int value, double timerInterval);
	void OnRender();
	void OnRenderOverlay();

	void OnStart();
	void OnStop();
	void OnPause();
	void OnResume();

	void OnKeyUp(int key);
	void OnKeyDown(int key);
	void OnSpecialKeyDown(int key);
	void OnSpecialKeyUp(int key);
	void OnMouseButtonDown(int button);
	void OnMouseButtonUp(int button);
	void OnMouseMotion(int x, int y, int xrel, int yrel, int buttons);
	void OnJoyAxis(int axis, float value, float delta);
	void OnJoyButtonDown(int button);
	void OnJoyButtonUp(int button);
private:
	Viperfish::Application *application;
};

extern GlutTemplate GLUT;

#endif
